home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
qbscrgen.zip
/
SGDEMO.BAS
next >
Wrap
BASIC Source File
|
1987-07-24
|
26KB
|
919 lines
rem $linesize:132
rem $title:'* Screen I/O Generator *'
rem $subtitle:'* Introduction *'
rem $include:'aecommon.bas'
'
' SGDEMO
'
' (c) Roy Barrow, 1986,1987.
'
dim fl$(255%),dl.2$(4%) ' File array, 2nd Key Select Array
dim text$(24%),datfrm$(3%) ' Lines 2-24
dim ip.frame%(24%,80%) ' Frame for input markers
dim var.type$(6%) ' Variable types
dim io.name$(100%) ' 100 Names for Input Definition
dim io.x%(100%) ' 100 X Locations
dim io.y%(100%) ' 100 Y Locations
dim mrec%(100%) ' 100 Master Pointers
dim basgen$(100%) ' Basic Generation Sequence Array
def fnn$(a%)=mid$(str$(a%),2%) ' Commonly used STRIPPER
data "Single String","Text Block","Date"
data "Integer","Single Precision","Double Precision"
data "mm/dd/yy","yy/mm/dd","dd/mm/yy"
for j%=1% to 6%
read var.type$(j%)
next j%
for j%=1% to 3%
read datfrm$(j%)
next j%
call color.init("appcolor.ctl")
menu1:
data 6,"File","Edit","Draw","Input","Exit","Color Setup"
data 7,"Load","Save","Merge","","Generate Basic","","Status"
data 9,"Copy of above line","Center Line","Insert Blank Line","Delete Line","Insert Column","Delete Column","Find & Replace","","Clear"
data 3,"Box","Vertical Line","Horizontal Line"
data 4,"Definition","","Remove","Clear"
data 3,"To Editor (ESC)","To Shell","To System"
data 1,"Define Attributes"
restore menu1
gosub get.menu
'
' The menu definition is now made. Now call the Introductory box
'
locate ,,0
call qbtools.frame
w$=input$(1%)
cls
ae.sstack%=2000%
call Centre.Text("Screen Generator Version: SGDEMO v 1.02",1%)
call startup
for j%=1% to 24%
text$(j%)=string$(80%,32%)
for k%=1% to 80%
ip.frame%(j%,k%)=0%
next k%
next j%
for j%=1% to 100%
io.name$(j%)=""
io.x%(j%)=0%
io.y%(j%)=0%
mrec%(j%)=0%
next j%
call scroll(1,2,80,24,0)
ins$="Off"
x%=1%
y%=2%
xmin%=1%
xmax%=80%
ymin%=2%
ymax%=24%
cycle%=0%
lsch%=32% ' Last special alternate character
dr.only%=0% ' Currently in NODRAW mode
while cycle%=0%
if ip.frame%(y%,x%) then
i.o.txt$="F5=I/O "
i.o.set%=1%
else
i.o.txt$=" "
i.o.set%=0%
end if
if dr.only%=1% then
i.o.txt$="Draw:"
if vl.draw%=1% then
i.o.txt$=i.o.txt$+"Vl"
end if
if hz.draw%=1% then
i.o.txt$=i.o.txt$+"Hl"
end if
if bx.draw%=1% then
i.o.txt$=i.o.txt$+"Box"
end if
end if
optex$="F1=Menu F2=Last Menu F3=Alt Ch F4=Last Alt Ch Ins="+ins$+" x="+fnn$(x%)+" y="+fnn$(y%)+" "+i.o.txt$
call qprint(optex$,25,1)
locate y%,x%,1%,0%,15% ' Display the cursor
call Get.Single(ch%,ctype%)
if dr.only%=0% then
if ctype%=2% then
if ch%=61% then
for j%=1% to 70%
fl$(j%)=chr$(j%+173%)
next j%
dialog$(1)="Select a"
dialog$(2)="Character"
dialog$(3)="From List"
dialog$(4)=""
call select.box(fl$(),8%,70%,1%,opt$)
ch%=asc(opt$)
lsch%=ch%
ctype%=1%
end if
end if
if ctype%=2% then ' Repeat last Alternate Character
if ch%=62% then
ch%=lsch%
ctype%=1%
end if
end if
if ctype%=2% then
if ch%=63% then ' Display i.o.definition
if i.o.set% then
nav%=ip.frame%(y%,x%)
rec%=mrec%(nav%)
get #11,rec%
vt%=asc(v.type$)
varn$=var.des$
call ctrl.trim(varn$)
dialog$(1%)="Variable: "+varn$+" ("+var.type$(vt%)+")"
if vt%=1% then
dialog$(2%)=str$(asc(s.len$))+" characters in length."
end if
if vt%=2% then
dialog$(2%)=str$(asc(b.width$))+" characters wide, and"+str$(asc(b.height$))+" lines high."
end if
if vt%=3% then
dialog$(2%)="Which is in the format:"
df%=asc(d.form$)
dialog$(2%)=dialog$(2%)+datfrm$(df%)+"."
end if
if (vt%=4% or vt%=6% or vt%=5%) then
dialog$(2%)="In value between"
dialog$(2%)=dialog$(2%)+str$(cvd(v.min$))+" and"+str$(cvd(v.max$))+"."
end if
dc%=2%
call Press.Any.Key(dc%)
end if
end if
end if
if ctype%=2% then
if ch%=59% or ch%=60% then
if ch%=59% then
where%=varptr(ae.screens%(1%))
locate ,,0
restore menu1
gosub get.menu
call Pull.Down.Menu
prvmen%=menu%
prvop%=menop%
end if
if ch%=60% then
menu%=prvmen%
menop%=prvop%
end if
if menu%=1% then
rem $subtitle:'Load an existing file.'
rem $page
if menop%=1% then ' Load a file
call getfiles(fl$(),"?","scr",count%)
if count%>0% then
call qsort(fl$(),count%)
dialog$(1)="Select file to load"
dialog$(2)="from the list on the"
dialog$(3)="left."
dialog$(4)=""
call select.box(fl$(),10%,count%,12%,opt$)
call ctrl.trim(opt$)
if len(opt$) then
open "r",1,opt$,80
opt$=left$(opt$,instr(opt$,".")-1%)
field #1,80 as s1$
for j%=1% to 24%
get #1,j%
text$(j%)=s1$
next j%
close 1
for j%=2% to 24%
call qprint(text$(j%),j%,1%)
next j%
end if
end if
if count%=0% then ' No file exists.
end if
end if
rem $subtitle:'Save a file.'
rem $page
if menop%=2% then ' Save a file
dialog$(1)="Save this file as ..."
dialog$(2)=""
fil.1$=string$(8%,32%)
l1%=8%
call Dialog(fil.1$,l1%)
call ctrl.trim(fil.1$)
if len(fil.1$) then
open "r",1,fil.1$+".SCR",80
field #1,80 as s1$
for j%=1% to 24%
lset s1$=text$(j%)
put #1,j%
next j%
close 1
end if
end if
rem $subtitle:'Merge a file.'
rem $page
if menop%=3% then ' Merge a file
call getfiles(fl$(),"?","scr",count%)
if count% then
call qsort(fl$(),count%)
end if
if count% then
dialog$(1)="Select file to merge from"
dialog$(2)="the list on the left. This"
dialog$(3)="option merges in screen"
dialog$(4)="text only. I/O is ignored."
call select.box(fl$(),10%,count%,12%,opt$)
call ctrl.trim(opt$)
if len(opt$) then
open "r",1,opt$,80
opt$=left$(opt$,instr(opt$,".")-1%)
field #1,80 as s1$
for j%=2% to 24%
get #1,j%
for k%=1% to 80%
if mid$(text$(j%),k%,1%)=" " then
mid$(text$(j%),k%,1%)=mid$(s1$,k%,1%)
end if
next k%
next j%
close 1
for j%=2% to 24%
call qprint(text$(j%),j%,1%)
next j%
end if
end if
end if
rem $subtitle:'Generate the BASIC code.'
rem $page
if menop%=5% then ' Generate Basic
dialog$(1)="BASIC program to create is ..."
dialog$(2)=""
fil.1$=string$(8%,32%)
l1%=8%
call Dialog(fil.1$,l1%)
call ctrl.trim(fil.1$)
open "o",1,fil.1$+".bas"
dialog$(1%)="Title this program ..."
dialog$(2%)=""
call Dialog(tit$,50%)
call ctrl.trim(tit$)
print #1,"rem $linesize:132"
print #1,"rem $title:'"+tit$+"'"
print #1,"rem $subtitle:'(c) Copyright Roy Barrow 1986,1987.'"
print #1,""
print #1,"' Screen Generator Version: SGDEMO"
print #1,"' This program ("+fil.1$+") created on: "+date$+", "+time$
print #1,""
print #1," call "+fil.1$+".frame"
print #1,""
print #1," END"
print #1,""
print #1," sub "+fil.1$+".frame static"
for j%=2% to 24%
w$=text$(j%)
call trim(w$)
if len(w$) then
w%=instr(text$(j%